<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>qLibc: utilities/qtime.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">qLibc
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('qtime_8c.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">qtime.c File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>Time handling APIs.  
<a href="#details">More...</a></p>

<p><a href="qtime_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a689f608f871f45fb772266bf1f18cdd7"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#a689f608f871f45fb772266bf1f18cdd7">qtime_current_milli</a> (void)</td></tr>
<tr class="memdesc:a689f608f871f45fb772266bf1f18cdd7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the current time in milliseconds.  <br /></td></tr>
<tr class="separator:a689f608f871f45fb772266bf1f18cdd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7f023ccf5f6120df54e4f1a9f034b9a9"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#a7f023ccf5f6120df54e4f1a9f034b9a9">qtime_localtime_strf</a> (char *buf, int size, time_t utctime, const char *format)</td></tr>
<tr class="memdesc:a7f023ccf5f6120df54e4f1a9f034b9a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get custom formmatted local time string.  <br /></td></tr>
<tr class="separator:a7f023ccf5f6120df54e4f1a9f034b9a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6116a83810dfd2d593e236abb417bdcd"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#a6116a83810dfd2d593e236abb417bdcd">qtime_localtime_str</a> (time_t utctime)</td></tr>
<tr class="memdesc:a6116a83810dfd2d593e236abb417bdcd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.  <br /></td></tr>
<tr class="separator:a6116a83810dfd2d593e236abb417bdcd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb4e26399a9e779429aa0592e4ad03b6"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#afb4e26399a9e779429aa0592e4ad03b6">qtime_localtime_staticstr</a> (time_t utctime)</td></tr>
<tr class="memdesc:afb4e26399a9e779429aa0592e4ad03b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.  <br /></td></tr>
<tr class="separator:afb4e26399a9e779429aa0592e4ad03b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11790ec49dee0ad865ca7392790a6b8b"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#a11790ec49dee0ad865ca7392790a6b8b">qtime_gmt_strf</a> (char *buf, int size, time_t utctime, const char *format)</td></tr>
<tr class="memdesc:a11790ec49dee0ad865ca7392790a6b8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get custom formmatted GMT time string.  <br /></td></tr>
<tr class="separator:a11790ec49dee0ad865ca7392790a6b8b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a393447c2ed7764c85937ecdb3ed5a252"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#a393447c2ed7764c85937ecdb3ed5a252">qtime_gmt_str</a> (time_t utctime)</td></tr>
<tr class="memdesc:a393447c2ed7764c85937ecdb3ed5a252"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.  <br /></td></tr>
<tr class="separator:a393447c2ed7764c85937ecdb3ed5a252"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac83d07a78536a71e3161c00156342677"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#ac83d07a78536a71e3161c00156342677">qtime_gmt_staticstr</a> (time_t utctime)</td></tr>
<tr class="memdesc:ac83d07a78536a71e3161c00156342677"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.  <br /></td></tr>
<tr class="separator:ac83d07a78536a71e3161c00156342677"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c536941cca900b390fc199eb3b50c6b"><td class="memItemLeft" align="right" valign="top">time_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qtime_8c.html#a6c536941cca900b390fc199eb3b50c6b">qtime_parse_gmtstr</a> (const char *gmtstr)</td></tr>
<tr class="memdesc:a6c536941cca900b390fc199eb3b50c6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">This parses GMT/Timezone(+/-) formatted time sting like 'Sun, 04 May 2008 18:50:39 GMT', 'Mon, 05 May 2008 03:50:39 +0900' and returns as universal time.  <br /></td></tr>
<tr class="separator:a6c536941cca900b390fc199eb3b50c6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Time handling APIs. </p>

<p class="definition">Definition in file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a8773045a81f883f2ab00761f45e8642c" name="a8773045a81f883f2ab00761f45e8642c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8773045a81f883f2ab00761f45e8642c">&#9670;&#160;</a></span>__USE_XOPEN</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define __USE_XOPEN</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00033">33</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="a78c99ffd76a7bb3c8c74db76207e9ab4" name="a78c99ffd76a7bb3c8c74db76207e9ab4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a78c99ffd76a7bb3c8c74db76207e9ab4">&#9670;&#160;</a></span>_XOPEN_SOURCE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define _XOPEN_SOURCE</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00034">34</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="ad3d8a3bd0c0b677acef144f2c2ef6d73" name="ad3d8a3bd0c0b677acef144f2c2ef6d73"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad3d8a3bd0c0b677acef144f2c2ef6d73">&#9670;&#160;</a></span>_BSD_SOURCE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define _BSD_SOURCE</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00035">35</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a689f608f871f45fb772266bf1f18cdd7" name="a689f608f871f45fb772266bf1f18cdd7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a689f608f871f45fb772266bf1f18cdd7">&#9670;&#160;</a></span>qtime_current_milli()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">long qtime_current_milli </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the current time in milliseconds. </p>
<dl class="section return"><dt>Returns</dt><dd>current time in milliseconds. </dd></dl>

<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00049">49</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="a7f023ccf5f6120df54e4f1a9f034b9a9" name="a7f023ccf5f6120df54e4f1a9f034b9a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7f023ccf5f6120df54e4f1a9f034b9a9">&#9670;&#160;</a></span>qtime_localtime_strf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qtime_localtime_strf </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">time_t&#160;</td>
          <td class="paramname"><em>utctime</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get custom formmatted local time string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>save buffer </td></tr>
    <tr><td class="paramname">size</td><td>buffer size </td></tr>
    <tr><td class="paramname">utctime</td><td>0 for current time, universal time for specific time </td></tr>
    <tr><td class="paramname">format</td><td>format for strftime()</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>string pointer of buf</dd></dl>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *timestr = <a class="code hl_function" href="qtime_8c.html#a7f023ccf5f6120df54e4f1a9f034b9a9">qtime_localtime_strf</a>(0, <span class="stringliteral">&quot;%H:%M:%S&quot;</span>); <span class="comment">// HH:MM:SS</span></div>
<div class="line">free(timestr);</div>
<div class="line"><span class="keywordtype">char</span> *timestr = <a class="code hl_function" href="qtime_8c.html#a7f023ccf5f6120df54e4f1a9f034b9a9">qtime_localtime_strf</a>(0, <span class="stringliteral">&quot;%Y%m%d%H%M%S&quot;</span>); <span class="comment">// YYMMDDhhmmss</span></div>
<div class="line">free(timestr);</div>
<div class="ttc" id="aqtime_8c_html_a7f023ccf5f6120df54e4f1a9f034b9a9"><div class="ttname"><a href="qtime_8c.html#a7f023ccf5f6120df54e4f1a9f034b9a9">qtime_localtime_strf</a></div><div class="ttdeci">char * qtime_localtime_strf(char *buf, int size, time_t utctime, const char *format)</div><div class="ttdoc">Get custom formmatted local time string.</div><div class="ttdef"><b>Definition</b> <a href="qtime_8c_source.html#l00073">qtime.c:73</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00073">73</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="a6116a83810dfd2d593e236abb417bdcd" name="a6116a83810dfd2d593e236abb417bdcd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6116a83810dfd2d593e236abb417bdcd">&#9670;&#160;</a></span>qtime_localtime_str()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qtime_localtime_str </td>
          <td>(</td>
          <td class="paramtype">time_t&#160;</td>
          <td class="paramname"><em>utctime</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get local time string formatted like '02-Nov-2007 16:37:39 +0900'. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">utctime</td><td>0 for current time, universal time for specific time</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>mallocked string pointer of time string</dd></dl>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *timestr;</div>
<div class="line">timestr = <a class="code hl_function" href="qtime_8c.html#a6116a83810dfd2d593e236abb417bdcd">qtime_localtime_str</a>(0);  <span class="comment">// now</span></div>
<div class="line">free(timestr);</div>
<div class="line">timestr = <a class="code hl_function" href="qtime_8c.html#a6116a83810dfd2d593e236abb417bdcd">qtime_localtime_str</a>(time(NULL));  <span class="comment">// same as above</span></div>
<div class="line">free(timestr);</div>
<div class="line">timestr = <a class="code hl_function" href="qtime_8c.html#a6116a83810dfd2d593e236abb417bdcd">qtime_localtime_str</a>(time(NULL) - 86400));  <span class="comment">// 1 day before</span></div>
<div class="line">free(timestr);</div>
<div class="ttc" id="aqtime_8c_html_a6116a83810dfd2d593e236abb417bdcd"><div class="ttname"><a href="qtime_8c.html#a6116a83810dfd2d593e236abb417bdcd">qtime_localtime_str</a></div><div class="ttdeci">char * qtime_localtime_str(time_t utctime)</div><div class="ttdoc">Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.</div><div class="ttdef"><b>Definition</b> <a href="qtime_8c_source.html#l00103">qtime.c:103</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00103">103</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="afb4e26399a9e779429aa0592e4ad03b6" name="afb4e26399a9e779429aa0592e4ad03b6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afb4e26399a9e779429aa0592e4ad03b6">&#9670;&#160;</a></span>qtime_localtime_staticstr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char * qtime_localtime_staticstr </td>
          <td>(</td>
          <td class="paramtype">time_t&#160;</td>
          <td class="paramname"><em>utctime</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get local time string formatted like '02-Nov-2007 16:37:39 +0900'. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">utctime</td><td>0 for current time, universal time for specific time</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>internal static string pointer of time string</dd></dl>
<div class="fragment"><div class="line">printf(<span class="stringliteral">&quot;%s&quot;</span>, <a class="code hl_function" href="qtime_8c.html#afb4e26399a9e779429aa0592e4ad03b6">qtime_localtime_staticstr</a>(0));  <span class="comment">// now</span></div>
<div class="line">printf(<span class="stringliteral">&quot;%s&quot;</span>, <a class="code hl_function" href="qtime_8c.html#afb4e26399a9e779429aa0592e4ad03b6">qtime_localtime_staticstr</a>(time(NULL) + 86400)); <span class="comment">// 1 day later</span></div>
<div class="ttc" id="aqtime_8c_html_afb4e26399a9e779429aa0592e4ad03b6"><div class="ttname"><a href="qtime_8c.html#afb4e26399a9e779429aa0592e4ad03b6">qtime_localtime_staticstr</a></div><div class="ttdeci">const char * qtime_localtime_staticstr(time_t utctime)</div><div class="ttdoc">Get local time string formatted like '02-Nov-2007 16:37:39 +0900'.</div><div class="ttdef"><b>Definition</b> <a href="qtime_8c_source.html#l00125">qtime.c:125</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00125">125</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="a11790ec49dee0ad865ca7392790a6b8b" name="a11790ec49dee0ad865ca7392790a6b8b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a11790ec49dee0ad865ca7392790a6b8b">&#9670;&#160;</a></span>qtime_gmt_strf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qtime_gmt_strf </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">time_t&#160;</td>
          <td class="paramname"><em>utctime</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get custom formmatted GMT time string. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>save buffer </td></tr>
    <tr><td class="paramname">size</td><td>buffer size </td></tr>
    <tr><td class="paramname">utctime</td><td>0 for current time, universal time for specific time </td></tr>
    <tr><td class="paramname">format</td><td>format for strftime()</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>string pointer of buf</dd></dl>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> timestr[8+1];</div>
<div class="line"><a class="code hl_function" href="qtime_8c.html#a11790ec49dee0ad865ca7392790a6b8b">qtime_gmt_strf</a>(buf, <span class="keyword">sizeof</span>(buf), 0, <span class="stringliteral">&quot;%H:%M:%S&quot;</span>); <span class="comment">// HH:MM:SS</span></div>
<div class="ttc" id="aqtime_8c_html_a11790ec49dee0ad865ca7392790a6b8b"><div class="ttname"><a href="qtime_8c.html#a11790ec49dee0ad865ca7392790a6b8b">qtime_gmt_strf</a></div><div class="ttdeci">char * qtime_gmt_strf(char *buf, int size, time_t utctime, const char *format)</div><div class="ttdoc">Get custom formmatted GMT time string.</div><div class="ttdef"><b>Definition</b> <a href="qtime_8c_source.html#l00148">qtime.c:148</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00148">148</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="a393447c2ed7764c85937ecdb3ed5a252" name="a393447c2ed7764c85937ecdb3ed5a252"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a393447c2ed7764c85937ecdb3ed5a252">&#9670;&#160;</a></span>qtime_gmt_str()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char * qtime_gmt_str </td>
          <td>(</td>
          <td class="paramtype">time_t&#160;</td>
          <td class="paramname"><em>utctime</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">utctime</td><td>0 for current time, universal time for specific time</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>malloced string pointer which points GMT time string.</dd></dl>
<div class="fragment"><div class="line"><span class="keywordtype">char</span> *timestr;</div>
<div class="line">timestr = <a class="code hl_function" href="qtime_8c.html#a393447c2ed7764c85937ecdb3ed5a252">qtime_gmt_str</a>(0);           <span class="comment">// now</span></div>
<div class="line">free(timestr);</div>
<div class="line">timestr = <a class="code hl_function" href="qtime_8c.html#a393447c2ed7764c85937ecdb3ed5a252">qtime_gmt_str</a>(time(NULL));      <span class="comment">// same as above</span></div>
<div class="line">free(timestr);</div>
<div class="line">timestr = <a class="code hl_function" href="qtime_8c.html#a393447c2ed7764c85937ecdb3ed5a252">qtime_gmt_str</a>(time(NULL) - 86400)); <span class="comment">// 1 day before</span></div>
<div class="line">free(timestr);</div>
<div class="ttc" id="aqtime_8c_html_a393447c2ed7764c85937ecdb3ed5a252"><div class="ttname"><a href="qtime_8c.html#a393447c2ed7764c85937ecdb3ed5a252">qtime_gmt_str</a></div><div class="ttdeci">char * qtime_gmt_str(time_t utctime)</div><div class="ttdoc">Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.</div><div class="ttdef"><b>Definition</b> <a href="qtime_8c_source.html#l00174">qtime.c:174</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00174">174</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="ac83d07a78536a71e3161c00156342677" name="ac83d07a78536a71e3161c00156342677"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac83d07a78536a71e3161c00156342677">&#9670;&#160;</a></span>qtime_gmt_staticstr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const char * qtime_gmt_staticstr </td>
          <td>(</td>
          <td class="paramtype">time_t&#160;</td>
          <td class="paramname"><em>utctime</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">utctime</td><td>0 for current time, universal time for specific time</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>internal static string pointer which points GMT time string.</dd></dl>
<div class="fragment"><div class="line">printf(<span class="stringliteral">&quot;%s&quot;</span>, <a class="code hl_function" href="qtime_8c.html#ac83d07a78536a71e3161c00156342677">qtime_gmt_staticstr</a>(0));         <span class="comment">// now</span></div>
<div class="line">printf(<span class="stringliteral">&quot;%s&quot;</span>, <a class="code hl_function" href="qtime_8c.html#ac83d07a78536a71e3161c00156342677">qtime_gmt_staticstr</a>(time(NULL) + 86400));    <span class="comment">// 1 day later</span></div>
<div class="ttc" id="aqtime_8c_html_ac83d07a78536a71e3161c00156342677"><div class="ttname"><a href="qtime_8c.html#ac83d07a78536a71e3161c00156342677">qtime_gmt_staticstr</a></div><div class="ttdeci">const char * qtime_gmt_staticstr(time_t utctime)</div><div class="ttdoc">Get GMT time string formatted like 'Wed, 11-Nov-2007 23:19:25 GMT'.</div><div class="ttdef"><b>Definition</b> <a href="qtime_8c_source.html#l00197">qtime.c:197</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00197">197</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
<a id="a6c536941cca900b390fc199eb3b50c6b" name="a6c536941cca900b390fc199eb3b50c6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6c536941cca900b390fc199eb3b50c6b">&#9670;&#160;</a></span>qtime_parse_gmtstr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">time_t qtime_parse_gmtstr </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>gmtstr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This parses GMT/Timezone(+/-) formatted time sting like 'Sun, 04 May 2008 18:50:39 GMT', 'Mon, 05 May 2008 03:50:39 +0900' and returns as universal time. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">gmtstr</td><td>GMT/Timezone(+/-) formatted time string</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>universal time(UTC). in case of conversion error, returns -1.</dd></dl>
<div class="fragment"><div class="line">time_t t = time(NULL);</div>
<div class="line"><span class="keywordtype">char</span> *s =  <a class="code hl_function" href="qtime_8c.html#a6c536941cca900b390fc199eb3b50c6b">qtime_parse_gmtstr</a>(t);</div>
<div class="line">printf(<span class="stringliteral">&quot;%d\n&quot;</span>, t);</div>
<div class="line">printf(<span class="stringliteral">&quot;%s\n&quot;</span>, s);</div>
<div class="line">printf(<span class="stringliteral">&quot;%d\n&quot;</span>, <a class="code hl_function" href="qtime_8c.html#a6c536941cca900b390fc199eb3b50c6b">qtime_parse_gmtstr</a>(s)); <span class="comment">// this must be same as t</span></div>
<div class="line">free(s);</div>
<div class="ttc" id="aqtime_8c_html_a6c536941cca900b390fc199eb3b50c6b"><div class="ttname"><a href="qtime_8c.html#a6c536941cca900b390fc199eb3b50c6b">qtime_parse_gmtstr</a></div><div class="ttdeci">time_t qtime_parse_gmtstr(const char *gmtstr)</div><div class="ttdoc">This parses GMT/Timezone(+/-) formatted time sting like 'Sun, 04 May 2008 18:50:39 GMT',...</div><div class="ttdef"><b>Definition</b> <a href="qtime_8c_source.html#l00223">qtime.c:223</a></div></div>
</div><!-- fragment --> 
<p class="definition">Definition at line <a class="el" href="qtime_8c_source.html#l00223">223</a> of file <a class="el" href="qtime_8c_source.html">qtime.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_7b5d38f1875f1b693f62ca6a108a1129.html">utilities</a></li><li class="navelem"><a class="el" href="qtime_8c.html">qtime.c</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7 </li>
  </ul>
</div>
</body>
</html>
